The present invention relates generally to passing information between client and server programs in a Web transaction environment.
The World Wide Web of the Internet is the most successful distributed application in the history of computing. In the Web environment, client machines effect transactions to Web servers use the Hypertext Transfer Protocol (HTTP), which is a known application protocol providing users access to files (e.g., text, graphics, images, sound, video, etc.) using a standard page description language known as Hypertext Markup Language (HTML). HTML provides basic document formatting and allows the developer to specify xe2x80x9clinksxe2x80x9d to other servers and files. In the Internet paradigm, a network path to a server is identified by a so-called Uniform Resource Locator (URL) having a special syntax for defining a network connection. Use of an HTML-compatible browser (e.g., Netscape Navigator) at a client machine involves specification of a link via the URL. In response, the client makes a request to the server identified in the link and receives in return a document formatted according to HTML.
HTTP servers available from Netscape Communications Corporation (Mountain View, Calif.) are in common use. Netscape HTTP servers provide a plug-in application programming interface (API) which allow non-Netscape programs to override or enhance the functionality of the HTTP server. In a typical Web transaction, an HTTP server follows a defined sequence of steps, called server methods, when responding to a request from an HTTP-compliant browser. These steps include authenticating user id""s and passwords, mapping URL""s to local filesystem path names, checking user access to translated paths, identifying additional object types on requests, performing service requests (e.g., return objects or execute CGI programs), and log server events. The plug-ins can be called to execute within a Netscape server process to override or complement these server methods.
Serving Common Gateway Interface (CGI) programs are an important part of the HTTP server function. CGI programs are typically used to return dynamic information and to respond to HTTP browser input in HTML forms. They normally run as child processes created under HTTP server processes. There has now been recognized a need to insert environment variables into CGI program processes. There are several reasons for this. Thus, for example, a plug-in might need to set authentication information in the child process so that a CGI program can access protected resources on the browser user""s behalf. Or, it may be desirable to set up application preferences specified by the user, or to set path information based on the location of a desired application.
Presently, Netscape HTTP servers do not provide a mechanism for setting dynamic, non-Netscape defined (sometimes referred to herein as xe2x80x9cnon-conformingxe2x80x9d) environment variables in CGI processes. Non-conforming environment variables can be set in the initial configuration (using the init-cgi directive), but these variables are not dynamic in that they cannot be set or modified by plug-ins. Plug-ins can partially define environment variables by inserting a variable name into a Netscape parameter block (pb) called request- greater than headers. However, when the Netscape send-cgi service method executes the CGI""s process, it xe2x80x9cmanglesxe2x80x9d the resulting environment variable by prepending xe2x80x9cHTTP_xe2x80x9d in front of the initial variable name. This is useful if the plug-in developer has control over the CGI programs being executed, but plug-ins may need to provide a service that is transparent to existing CGI programs.
It would therefore be desirable to provide a mechanism to pass non-conforming environment variables from plug-ins to CGI processes and preferably without fully overriding the server send-cgi service method.
It is thus a primary object of the invention to enhance the functionality of an HTTP server application programming interface to enable passing of non-conforming environment variables from hypertext transfer protocol (HTTP) server plug-ins to Common Gateway Interface (CGI) programs.
It is a more particular object to provide a mechanism to pass non-conforming environment variables from plug-ins to CGI processes without completely overriding a send-cgi service method of the HTTP server.
It is a more general object of the invention to enhance the functionality of an HTTP server application programming interface without modifying the server method used to handle CGI service requests.
These and other objects of the invention are achieved in a method of enabling a generic plug-in of an HTTP server to pass an unmangled environment variable into a CGI process. In accordance with a preferred embodiment, the method begins by configuring the HTTP server to initially override a CGI service method. When the server processes an HTTP request, the generic plug-in, which is called prior to the CGI service method and is running in a process of the HTTP server, inserts a xe2x80x9cname valuexe2x80x9d pair prepended with a marker in a request header parameter block of the HTTP server. Then, a CGI service override method of the invention executes the server""s original (i.e. native) CGI service method, causing it to run an encapsulation program in the CGI process. This program scans the environment of the CGI process for any string prepended with a given HTTP code (e.g., the string xe2x80x9cHTTP_xe2x80x9d) and the marker. If it finds any such string, the program strips the given HTTP code and the marker from a remainder of the string and resets the environment variable into the CGI process in an xe2x80x9cunmangledxe2x80x9d form. The target CGI program is then executed in the CGI process.
The foregoing has outlined some of the more pertinent objects and features of the present invention. These objects should be construed to be merely illustrative of some of the more prominent features and applications of the invention. Many other beneficial results can be attained by applying the disclosed invention in a different manner or modifying the invention as will be described. Accordingly, other objects and a fuller understanding of the invention may be had by referring to the following Detailed Description of the Preferred Embodiment.